home *** CD-ROM | disk | FTP | other *** search
/ Inter.Net 55-1 / Inter.Net 55-1.iso / CBuilder / Setup / BCB / data.z / cpl.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1998-02-09  |  8.0 KB  |  210 lines

  1.  
  2. {*******************************************************}
  3. {                                                       }
  4. {       Delphi Run-time Library                         }
  5. {       Control panel extension DLL definitions         }
  6. {                                                       }
  7. {       Copyright (c) 1998 Borland International        }
  8. {                                                       }
  9. {*******************************************************}
  10.  
  11. unit CPL;
  12.  
  13. {$HPPEMIT '#include <cpl.h>'}
  14.  
  15. interface
  16.  
  17. uses Messages, Windows;
  18.  
  19. {  General rules for being installed in the Control Panel:
  20.  
  21.       1) The DLL must export a function named CPlApplet which will handle
  22.          the messages discussed below.
  23.       2) If the applet needs to save information in CONTROL.INI minimize
  24.          clutter by using the application name [MMCPL.appletname].
  25.       2) If the applet is refrenced in CONTROL.INI under [MMCPL] use
  26.          the following form:
  27.               ...
  28.               [MMCPL]
  29.               uniqueName=c:\mydir\myapplet.dll
  30.               ...
  31.  
  32.  
  33.   The order applet DLL's are loaded by CONTROL.EXE is:
  34.  
  35.       1) MAIN.CPL is loaded from the windows system directory.
  36.  
  37.       2) Installable drivers that are loaded and export the
  38.          CplApplet() routine.
  39.  
  40.       3) DLL's specified in the [MMCPL] section of CONTROL.INI.
  41.  
  42.       4) DLL's named *.CPL from windows system directory.
  43.  
  44.  
  45.  CONTROL.EXE will answer this message and launch an applet
  46.  
  47.  WM_CPL_LAUNCH
  48.  
  49.       wParam      - window handle of calling app
  50.       lParam      - LPTSTR of name of applet to launch
  51.  
  52.  WM_CPL_LAUNCHED
  53.  
  54.       wParam      - TRUE/FALSE if applet was launched
  55.       lParam      - NULL
  56.  
  57.  CONTROL.EXE will post this message to the caller when the applet returns
  58.  (ie., when wParam is a valid window handle)
  59. }
  60.  
  61. const
  62.   {$EXTERNALSYM WM_CPL_LAUNCH}
  63.   WM_CPL_LAUNCH   = (WM_USER+1000);
  64.   {$EXTERNALSYM WM_CPL_LAUNCHED}
  65.   WM_CPL_LAUNCHED = (WM_USER+1001);
  66.  
  67.   // The messages CPlApplet() must handle:
  68.   {$EXTERNALSYM CPL_DYNAMIC_RES}
  69.   CPL_DYNAMIC_RES = 0;
  70.   { This constant may be used in place of real resource IDs for the idIcon,
  71.     idName or idInfo members of the CPLINFO structure.  Normally, the system
  72.     uses these values to extract copies of the resources and store them in a
  73.     cache.  Once the resource information is in the cache, the system does not
  74.     need to load a CPL unless the user actually tries to use it.
  75.  
  76.     CPL_DYNAMIC_RES tells the system not to cache the resource, but instead to
  77.     load the CPL every time it needs to display information about an item.  This
  78.     allows a CPL to dynamically decide what information will be displayed, but
  79.     is SIGNIFICANTLY SLOWER than displaying information from a cache.
  80.     Typically, CPL_DYNAMIC_RES is used when a control panel must inspect the
  81.     runtime status of some device in order to provide text or icons to display.
  82.   }
  83.   {$EXTERNALSYM CPL_INIT}
  84.   CPL_INIT = 1;
  85.   { This message is sent to indicate CPlApplet() was found. lParam1 and lParam2
  86.     are not defined. Return TRUE or FALSE indicating whether the control panel
  87.     should proceed.
  88.   }
  89.   {$EXTERNALSYM CPL_GETCOUNT}
  90.   CPL_GETCOUNT = 2;
  91.   { This message is sent to determine the number of applets to be displayed.
  92.     lParam1 and lParam2 are not defined. Return the number of applets you wish
  93.     to display in the control
  94.     panel window.
  95.   }
  96.   {$EXTERNALSYM CPL_INQUIRE}
  97.   CPL_INQUIRE = 3;
  98.   { This message is sent for information about each applet. lParam1 is the
  99.     applet number to register, a value from 0 to(CPL_GETCOUNT - 1).
  100.     lParam2 is a far ptr to a CPLINFO structure. Fill in CPL_INFO's idIcon,
  101.     idName, idInfo and lData fields with the resource id for an icon to
  102.     display, name and description string ids, and a long data item
  103.     associated with applet #lParam1.
  104.   }
  105.   {$EXTERNALSYM CPL_SELECT}
  106.   CPL_SELECT = 4;
  107.   { This message is sent when the applet's icon has been clicked upon.
  108.     lParam1 is the applet number which was selected.  lParam2 is the
  109.     applet's lData value.
  110.   }
  111.   {$EXTERNALSYM CPL_DBLCLK}
  112.   CPL_DBLCLK = 5;
  113.   { This message is sent when the applet's icon has been double-clicked
  114.     upon.  lParam1 is the applet number which was selected.  lParam2 is the
  115.     applet's lData value. This message should initiate the applet's dialog box.
  116.   }
  117.   {$EXTERNALSYM CPL_STOP}
  118.   CPL_STOP = 6;
  119.   { This message is sent for each applet when the control panel is exiting.
  120.     lParam1 is the applet number.  lParam2 is the applet's lData  value.
  121.     Do applet specific cleaning up here.
  122.   }
  123.   {$EXTERNALSYM CPL_EXIT}
  124.   CPL_EXIT = 7;
  125.   { This message is sent just before the control panel calls FreeLibrary.
  126.     lParam1 and lParam2 are not defined.
  127.     Do non-applet specific cleaning up here.
  128.   }
  129.   {$EXTERNALSYM CPL_NEWINQUIRE}
  130.   CPL_NEWINQUIRE = 8;
  131.   { This is the same as CPL_INQUIRE execpt lParam2 is a pointer to a
  132.     NEWCPLINFO structure.  this will be sent before the CPL_INQUIRE
  133.     and if it is responed to (return != 0) CPL_INQUIRE will not be sent
  134.   }
  135.   {$EXTERNALSYM CPL_STARTWPARMS}
  136.   CPL_STARTWPARMS = 9;
  137.   { This message parallels CPL_DBLCLK in that the applet should initiate
  138.     its dialog box.  where it differs is that this invocation is coming
  139.     out of RUNDLL, and there may be some extra directions for execution.
  140.     lParam1: the applet number.
  141.     lParam2: an LPSTR to any extra directions that might exist.
  142.     returns: TRUE if the message was handled; FALSE if not.
  143.   }
  144.   {$EXTERNALSYM CPL_SETUP}
  145.   CPL_SETUP = 200;
  146.   { This message is internal to the Control Panel and MAIN applets.
  147.     It is only sent when an applet is invoked from the Command line
  148.     during system installation.
  149.   }
  150.  
  151. type
  152.   //A function prototype for CPlApplet()
  153.   {$EXTERNALSYM APPLET_PROC}
  154.   APPLET_PROC = function (hwndCPl: THandle; uMsg: DWORD;
  155.                          lParam1, lParam2: Longint): Longint; stdcall;
  156.   TCPLApplet = APPLET_PROC;
  157.  
  158.   //The data structure CPlApplet() must fill in.
  159.   PCPLInfo = ^TCPLInfo;
  160.   {$EXTERNALSYM tagCPLINFO}
  161.   tagCPLINFO = packed record
  162.      idIcon: Integer;  // icon resource id, provided by CPlApplet()
  163.      idName: Integer;  // name string res. id, provided by CPlApplet()
  164.      idInfo: Integer;  // info string res. id, provided by CPlApplet()
  165.      lData : Longint;  // user defined data
  166.   end;
  167.   {$EXTERNALSYM CPLINFO}
  168.   CPLINFO = tagCPLINFO;
  169.   TCPLInfo = tagCPLINFO;
  170.  
  171.   PNewCPLInfoA = ^TNewCPLInfoA;
  172.   PNewCPLInfoW = ^TNewCPLInfoW;
  173.   PNewCPLInfo = PNewCPLInfoA;
  174.   {$EXTERNALSYM tagNEWCPLINFOA}
  175.   tagNEWCPLINFOA = packed record
  176.     dwSize:        DWORD;   // similar to the commdlg
  177.     dwFlags:       DWORD;
  178.     dwHelpContext: DWORD;   // help context to use
  179.     lData:         Longint; // user defined data
  180.     hIcon:         HICON;   // icon to use, this is owned by CONTROL.EXE (may be deleted)
  181.     szName:        array[0..31] of AnsiChar;    // short name
  182.     szInfo:        array[0..63] of AnsiChar;    // long name (status line)
  183.     szHelpFile:    array[0..127] of AnsiChar;   // path to help file to use
  184.   end;
  185.   {$EXTERNALSYM tagNEWCPLINFOW}
  186.   tagNEWCPLINFOW = packed record
  187.     dwSize:        DWORD;   // similar to the commdlg
  188.     dwFlags:       DWORD;
  189.     dwHelpContext: DWORD;   // help context to use
  190.     lData:         Longint; // user defined data
  191.     hIcon:         HICON;   // icon to use, this is owned by CONTROL.EXE (may be deleted)
  192.     szName:        array[0..31] of WideChar;    // short name
  193.     szInfo:        array[0..63] of WideChar;    // long name (status line)
  194.     szHelpFile:    array[0..127] of WideChar;   // path to help file to use
  195.   end;
  196.   {$EXTERNALSYM tagNEWCPLINFO}
  197.   tagNEWCPLINFO = tagNEWCPLINFOA;
  198.   {$EXTERNALSYM NEWCPLINFOA}
  199.   NEWCPLINFOA = tagNEWCPLINFOA;
  200.   {$EXTERNALSYM NEWCPLINFOW}
  201.   NEWCPLINFOW = tagNEWCPLINFOW;
  202.   {$EXTERNALSYM NEWCPLINFO}
  203.   NEWCPLINFO = NEWCPLINFOA;
  204.   TNewCPLInfoA = tagNEWCPLINFOA;
  205.   TNewCPLInfoW = tagNEWCPLINFOW;
  206.   TNewCPLInfo = TNewCPLInfoA;
  207.  
  208. implementation
  209. end.
  210.